package com.example.demo.vo;

import com.diboot.core.binding.annotation.*;
import com.example.demo.entity.ProductionOrder;
import com.example.demo.entity.ProductionOrder;
import com.example.demo.entity.Orders;
import com.example.demo.entity.OrderSku;
import com.diboot.iam.entity.IamUser;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.List;

/**
 * 生产单 DetailVO定义
 * @author MyName
 * @version 1.0
 * @date 2024-02-26
 * Copyright © MyCompany
 */
@Getter
@Setter
@Accessors(chain = true)
public class ProductionOrderDetailVO extends ProductionOrder {

    private static final long serialVersionUID = 1885393217907506753L;

    /**
     * 关联字段 生产单.标题：ProductionOrder.title
     */
    @BindField(entity = ProductionOrder.class, field = "title", condition = "this.parent_id=id")
    private String parentTitle;

    /**
     * 关联字段 系统用户.真实姓名：IamUser.realname
     */
    @BindField(entity = IamUser.class, field = "realname", condition = "this.iam_user_id=id")
    private String iamUserRealname;

    /**
     * 关联字段 系统用户.真实姓名：IamUser.realname
     */
    @BindField(entity = IamUser.class, field = "realname", condition = "this.create_by=id")
    private String createByName;

    /**
     * 关联字段 系统用户.真实姓名：IamUser.realname
     */
    @BindField(entity = IamUser.class, field = "realname", condition = "this.update_by=id")
    private String updateByName;

    // 绑定children
    @BindEntityList(entity = ProductionOrder.class, condition = "this.id=parent_id")
    private List<ProductionOrder> children;

    /**
     * 关联字典：TASK_STATUS
     */
    @BindDict(type = DICT_TASK_STATUS, field = "status")
    private String statusLabel;
}
